package com.hsytech.dijiebao.account;

import com.hsytech.dijiebao.MainActivity;
import com.hsytech.dijiebao.R;
import com.hsytech.dijiebao.base.BaseActivity;
import com.hsytech.dijiebao.base.BaseApplication;

import android.os.Bundle;
import android.os.Handler;

import cn.jpush.android.api.JPushInterface;
import io.rong.imkit.RongIM;

public class SplashActivity extends BaseActivity {

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_welcome);
		// voice��ʼ��
		// appid=56930eca
		// SpeechUtility.createUtility(getApplicationContext(),
		// SpeechConstant.APPID + "=56930eca");
		// BaseVoice.baseVoice.getInstance(getApplicationContext());
		// BaseVoice.baseVoice.setVoice("henry");
		// BaseVoice.baseVoice.startSpeaking("");
		// mTts.startSpeaking("The new journey, we accompany, to meet the
		// treasure,finally we are family", mSynListener);
		// jpush
		JPushInterface.setDebugMode(true); // ���ÿ�����־,����ʱ��ر���־
		JPushInterface.init(this); // ��ʼ�� JPush
		/**
		 * OnCreate �ᱻ����������룬��α������룬ȷ��ֻ������Ҫʹ�� RongIM �Ľ��̺� Push ����ִ���� init��
		 * io.rong.push Ϊ���� push �������ƣ������޸ġ�
		 */
		if (getApplicationInfo().packageName.equals(BaseApplication.getCurProcessName(getApplicationContext()))
				|| "io.rong.push".equals(BaseApplication.getCurProcessName(getApplicationContext()))) {

			/**
			 * IMKit SDK���õ�һ�� ��ʼ��
			 */
//			RongIM.init(getApplicationContext());

		}

		nextActivity();
	}

	@Override
	protected void onResume() {
		JPushInterface.onResume(getApplicationContext());
		super.onResume();
	}

	@Override
	protected void onPause() {
		JPushInterface.onPause(getApplicationContext());
		super.onPause();
	}

	private void nextActivity() {
		Handler handler = new Handler();
		handler.postDelayed(new Runnable() {
			@Override
			public void run() {
				callNewActivity(MainActivity.class);

			}

		}, 4000);

	}

}
